directory_delete

This function irreversibly deletes the specified directory, including any files and directories that may be present within it.

bool directory_delete(string directory_name)

Parameters:
directory_name
The name of the directory to delete.

Return value:
true on success, false on failure.

Remarks:
Please note that certain attributes on files or directories can cause the deletion to fail. Also, if a file inside the directory is currently being used by another program, the operation will fail when it gets to this file. This means that the folder will end up in a half deleted state with some files and directories gone and others remaining.

IMPORTANT! Be very careful when using this function, as it deletes not only the directory specified but all the files and directories that may be present inside it as well. Thus, calling it with a directory path such as C:\Windows may have disastrous results.

This function works with both absolute and relative paths.

Please note that the path may not end in a trailing slash or backslash, and may not contain wildcards.

Example:
// Delete the directory C:\test

void main()
{
if(directory_delete("C:\\test"))
{
alert("Information", "The directory was deleted successfully.");
}
else
{
alert("Error", "The directory could not be deleted.");
}
}